package com.duoduo.common.response;

/**
 *  返回状态码
 * @author
 * @version 1.0
 * @date
 * @description
 */
public enum ErrorCode {
    /**
     *  正常返回状态
     */
    OK("00000","一切OK"),
    A_CLIENT_ERROR("A0001","用户端错误"),
    A_USER_REGISTRATION_ERROR("A0100","用户注册错误"),
    A_NO_PRIVACY_AGREEMENT("A0101", "用户未同意隐私协议");

    private final String value;

    private final String reasonPhrase;

    private ErrorCode(String value, String reasonPhrase) {
        this.value = value;
        this.reasonPhrase = reasonPhrase;
    }

    /**
     * 返回此状态代码。
     */
    public String value() {
        return this.value;
    }

    /**
     * 返回此状态代码的原因短语。
     */
    public String getReasonPhrase() {
        return reasonPhrase;
    }

    /**
     * 返回具有指定数值的此类型的枚举常量。
     *
     * @param statusCode the numeric value of the enum to be returned
     * @return the enum constant with the specified numeric value
     * @throws IllegalArgumentException if this enum has no constant for the specified numeric value
     */
//    public static ErrorCode valueOf1(String statusCode) {
//        for (ErrorCode code : values()) {
//            if (code.value.equals(statusCode)) {
//                return code;
//            }
//        }
//        throw new IllegalArgumentException("No matching constant for [" + statusCode + "]" );
//    }

}
